﻿Imports TodoMicroSolutionPackV1.dal.dto
Public Class constantsUtil
    Public Shared Function isAlicuotaIva(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "alicuota_iva"
    End Function

    Public Shared Function isUnidadMedida(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "unidades_medida"
    End Function

    Public Shared Function isMoneda(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "moneda"
    End Function

    Public Shared Function isTipoComprobante(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "comprobante"
    End Function
    Public Shared Function isConcepto(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "concepto"
    End Function
    Public Shared Function isTipoDocumento(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And c.tipo = "documento"
    End Function
    Public Shared Function isPosicionIva(ByRef c As constante) As Boolean
        Return c.categoria = "facturacion" And (c.tipo = "condicion_iva_a" Or c.tipo = "condicion_iva_b")
    End Function
    Public Shared Function isTipoEntidad(ByRef c As constante) As Boolean
        Return c.categoria = "entidades" And c.tipo = "tipo"
    End Function
    Public Shared Function comprobanteCondicionIva(ByRef c As constante) As String
        If Not (c.categoria = "facturacion" And c.tipo = "comprobante") Then
            Throw New ApplicationException("La constante no corresponde a un tipo de comprobante")
        End If
        If c.codigo = 63 Or c.codigo = 60 Or c.codigo = 39 Or c.codigo = 34 Or c.codigo = 5 Or c.codigo = 4 Or c.codigo = 3 Or c.codigo = 2 Or c.codigo = 1 Then
            Return "A"
        Else
            Return "B"
        End If
    End Function

    Public Shared Function comprobanteLetra(ByRef c As constante) As String
        If Not (c.categoria = "facturacion" And c.tipo = "comprobante") Then
            Throw New ApplicationException("La constante no corresponde a un tipo de comprobante")
        End If
        If c.codigo = 63 Or c.codigo = 60 Or c.codigo = 39 Or c.codigo = 34 Or c.codigo = 5 Or c.codigo = 4 Or c.codigo = 3 Or c.codigo = 2 Or c.codigo = 1 Then
            Return "A"
        Else
            Return "B"
        End If
    End Function
End Class
